<!DOCTYPE HTML>
<html>
<head>
<style>
</style>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<iframe id="frame" src='data:text/html,<input type="range"></input>'></iframe>
<script>
    description("Make sure we don't ASSERT when an input element with a built-in touch handler is deleted after previously being removed from the document - crbug.com/285299.");

    window.jsTestIsAsync = true;

    var rects;
    document.getElementById('frame').addEventListener('load', function() {
        // Verify we actually have a hit rect on the page.
        if (window.internals) {
          internals.forceCompositingUpdate(document);
          rects = internals.touchEventTargetLayerRects(document);
          shouldBe("rects.length", "1");
        }

        document.getElementById("frame").remove();
        if (window.internals) {
            internals.forceCompositingUpdate(document);
            rects = internals.touchEventTargetLayerRects(document);
            shouldBe("rects.length", "0");
        }
        window.setTimeout(function() {
            gc();
            finishJSTest();
        }, 0);
    });

</script>
</body>
</html>
